home *** CD-ROM | disk | FTP | other *** search
-
- /* HERC.C - (c) 1990 TommySoftware
-
- A sample program used for displaying prictures exported from
- MegaPaint PC with the command "Export bitimage-Hercules"
-
- Notes:
- - You must have a Borland's Turbo-C to compile this program.
- - There should be a file called HERC.BGI supplied by Borland
- in the current directory when you run this program.
- - Program is called with one parameter which is the full name
- of the 32k file exported from MegaPaint PC with the command
- "Export bitimage-Hercules"
-
- */
-
-
-
- #include <stdio.h>
- #include <conio.h>
- #include <graphics.h>
-
-
- int main(int argc, char *argv[])
- {
- int grdriver, grmode, err;
- FILE *fp;
- unsigned i;
- char far *screen = (char far *)0xB0000000L;
-
- if (argc < 2) {
- printf("File name required.\n");
- return 1;
- }
-
- grdriver = DETECT;
- initgraph(&grdriver,&grmode,"");
- err = graphresult();
- if (err != grOk) {
- printf("ERROR: %s\n", grapherrormsg(err));
- return 2;
- }
- if (grdriver != HERCMONO) {
- closegraph();
- printf("You must have a hercules graphic adapter to run this program.\n");
- return 3;
- }
-
- fp = fopen(argv[1], "rb");
- if (fp == NULL) {
- closegraph();
- printf("File '%s' not found.\n", argv[1]);
- return 4;
- }
-
- for (i=0; i<32768; i++) screen[i] = fgetc(fp);
-
- fclose(fp);
- getch();
- closegraph();
-
- return 0;
- }